package com.crp.unitalinforbaseplat.app.unitalinforbaseplat.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.crp.unitalinforbaseplat.app.unitalinforbaseplat.entity.InventoryReport;
import com.crp.unitalinforbaseplat.app.unitalinforbaseplat.entity.PageBean;
import com.crp.unitalinforbaseplat.app.unitalinforbaseplat.service.IInventoryReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 库存报表 前端控制器
 * </p>
 *
 * @author zsx
 * @since 2020-04-20
 */
@RestController
@RequestMapping("/inventory-report")
public class InventoryReportController {
    @Autowired
    IInventoryReportService inventoryReportService;

    @ResponseBody
    @RequestMapping("/list")
    PageBean<InventoryReport> index(@RequestParam("inventoryId") Integer inventoryId) {
        PageBean<InventoryReport> pageBean = new PageBean<InventoryReport>();
        List<InventoryReport> inventoryReportList = inventoryReportService.list(new LambdaQueryWrapper<InventoryReport>().eq(InventoryReport::getInventoryId,inventoryId));
        pageBean.setData(inventoryReportList);
        return pageBean;
    }

}
